<template>
	<view class="app">
		<view class="app-container">
			<view class="action">
				<input type="file" class="upload" />
				<button class="cu-btn block bg-primary margin-tb-sm lg" @tap="chooseMessageFile">微信导入</button>
				<file-uploader></file-uploader>
				<view class="text-center">仅支持上传word/excel/pdf格式文件</view>
				<view class="text-center text-gray">
					<text class="cuIcon-question"></text>
					使用帮助
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import fileUploader from './components/xiaoshaoxin-fileUploader/fileUploader.vue'
export default {
	components: {
		fileUploader
	},
	methods: {
		chooseMessageFile() {
			uni.chooseMessageFile({
				count: 1,
				type: 'file',
				extension: ['pdf', 'doc', 'docx', 'xls', 'xlsx'],
				success: res => {
					console.log(res);
				}
			});
		},
		clickFileUpload() {},
		handleMessage(evt) {
			let msg = '@message传递数据：' + JSON.stringify(evt.detail.data);
			uni.showModal({
				content: msg,
				showCancel: false
			});
			console.log(msg);
			// todo 写入到store中
		}
	}
};
</script>

<style lang="scss">
.app-container {
	height: 100%;
	position: relative;
	.upload-web {
		padding: 0 20px;
		font-size: 16px;
		height: 40px;
	}
	.upload {
		// display: none;
	}
	.action {
		bottom: 36px;
		left: 16px;
		right: 16px;
		width: 100%;
		position: absolute;
		height: 35%;
	}
}
</style>
